//
//  ShopCarTableViewCell.m
//  reSearchDemo
//
//  Created by 云库 on 15/9/28.
//  Copyright (c) 2015年 Kiwaro. All rights reserved.
//

#import "ShopCarTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation ShopCarTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setDeal:(GoodsCarList *)deal{
    _deal = deal;
    if (deal.isSelect) {
        self.smallImg.image = [UIImage imageNamed:@"ic_01_h_"];
    }else {
        self.smallImg.image = [UIImage imageNamed:@"ic_01_n_@2x"];
    }
    
    
    [self.image sd_setImageWithURL:[NSURL URLWithString:deal.image] placeholderImage:[UIImage imageNamed:@"默认图片.png"]];
    self.goodsName.text = deal.goodsname;
    self.speval.text = deal.specVal;
    self.num.text = [NSString stringWithFormat:@"x%d",deal.num];
    self.money.text = [NSString stringWithFormat:@"￥%.2f",deal.money];
}

- (IBAction)ReductionBtnAction:(id)sender {
    if (self.deal.num > 1) {
        self.deal.num--;
        self.num.text = [NSString stringWithFormat:@"x%d",self.deal.num];
        if (self.block) {
            self.block(self.deal.cars_box_id,self.deal.num);
        }
    }
}
- (IBAction)AddBtnAction:(id)sender {
    self.deal.num++;
    self.num.text = [NSString stringWithFormat:@"x%d",self.deal.num];
    if (self.block) {
        self.block(self.deal.cars_box_id,self.deal.num);
    }
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
